package com.blockmeta.bbs.businesslibrary.widget.chartview.Axis;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;


import com.blockmeta.bbs.baselibrary.utils.DimentionsUtil;
import com.blockmeta.bbs.businesslibrary.widget.chartview.CoinChart;
import com.blockmeta.bbs.businesslibrary.widget.chartview.Layer.Layer;

import java.util.ArrayList;
import java.util.List;

public abstract class Axis
{
	protected boolean m_bIsShowAxis = true;
	protected boolean m_bIsShowCoordinate = true;
	protected boolean m_bIsShowLine = false;



	protected CoinChart.AxisPercentType m_bIsShowPercent = CoinChart.AxisPercentType.NOPERCENT;
	protected float m_fTextSize = DimentionsUtil.sp2px(10);
	protected String m_strTitle = "";
	protected boolean m_bShowTitle = false;

	protected List<Point> m_arrPointList;
	protected AxisCallback m_callback;
	public float m_fy0Value = 0.f;

	public Axis()
	{
		m_arrPointList = new ArrayList<Point>();
	}

	public void setCallback(AxisCallback pCallback)
	{
		m_callback = pCallback;
	}

	public void setPointList(List<Point> pList)
	{
		m_arrPointList = pList;
	}

	public List<Point> getPointList()
	{
		return m_arrPointList;
	}

	public void setShowAxis(boolean pShow)
	{
		m_bIsShowAxis = pShow;
	}

	public void setTextSize(float pSize)
	{
		m_fTextSize = pSize;
	}
	
	public float getTextSize()
	{
		return m_fTextSize;
	}

	public void isShowTitle(boolean pShow)
	{
		m_bShowTitle = pShow;
	}

	public boolean isShowTitle()
	{
		return m_bShowTitle;
	}

	public void setIsShowPercent(CoinChart.AxisPercentType m_bIsShowPercent)
	{
		this.m_bIsShowPercent = m_bIsShowPercent;
	}

	public void setTitle(String pTitle)
	{
		m_strTitle = pTitle;
	}

	public abstract void drawAxis(Canvas pCanvas, Paint pPaint);

	public abstract void drawAxisText(Canvas pCanvas, Paint pPaint);

	public abstract void drawAxis(Canvas pCanvas, int startIndex , int xTagCount , Paint pPaint);

	public interface AxisCallback
	{
		RectF getChartRectF();
		
		float getXTextSpace();
		
		float getYTextSpace();

		Rect getPanelRect();

		CoinChart.PointLocation getOriginPointLocation();

		boolean isCoordinateTextOuterY();

		float getYesterdayClose();

		boolean isOnlyShowSquareNum();

		boolean isNeedUpDownSpace();

		Layer.ChartTypeEnum getCharTypeEnum();

	}
}
